package middleware

import (
	"net/http"
)

type AuthMiddleware struct {
	Next http.Handler
}

func (am *AuthMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {

	if am.Next == nil {
		am.Next = http.DefaultServeMux
	}

	am.Next.ServeHTTP(w, r)
	// auth := r.Header.Get("Authorization")

	// token := strings.TrimPrefix(auth, "Bearer ")

	// // 验证 Authorization 一大堆的代码  这里写死一下

	// if token == "YWxpY2U6cGE1NXdvcmQ=" {
	// 	am.Next.ServeHTTP(w, r)
	// } else {
	// 	w.WriteHeader(http.StatusUnauthorized)
	// }
}
